package com.lzw.service.impl.admin;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.lzw.mapper.admin.ReturnsManage2Mapper;
import com.lzw.pojo.Returns;
import com.lzw.service.admin.ReturnsManage2Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.util.List;

@Service
public class ReturnsManage2ServiceImpl implements ReturnsManage2Service {

    @Autowired
    private ReturnsManage2Mapper returnsManage2Mapper;

    @Override
    public List<Returns> list(Integer pageNum, Integer pageSize, String medicine, LocalDate returnDate) {
        PageHelper.startPage(pageNum,pageSize);
        List<Returns> list = returnsManage2Mapper.list(medicine, returnDate);
        Page<Returns> returns = (Page<Returns>) list;
        return returns;    }

    @Override
    public void update(Returns returns) {
        returns.setReturnDate(LocalDate.now());
        returnsManage2Mapper.update(returns);
    }
}
